package io.github.talelin.latticy.repository;

import io.github.talelin.latticy.entity.Group;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

public interface GroupRepository extends JpaRepository<Group, Long> {

   Group findFirstByLevel(String level);

   @Query("select g.id from Group g where g.level in :level")
   List<Long> findByLevelIn(List<String> level);

   @Query("select g.level from Group g where g.id in :groupId")
   List<String> findLevelByIdIn(List<Long> groupId);
}
